package cate.game.role.bag.prop.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBBag;
import easy.java.dev.note.NoteField;
import easy.java.practice.errorcode.EcResult;

import java.util.ArrayList;
import java.util.List;

@ClientMsg(title = "自定义徽章 の 请求")
@OperationSetter(value = GDOperation.RUNE_BOX_USE, sub="tid")
public class CustomRuneUseReq implements MsgInput {
    @NoteField(value = "道具id")
    public int tid;

    @NoteField(value = "自选技能")
    public List<Integer> skills = new ArrayList<>();

    @Override
    public void execute(GameBody game, ClientContext cc) {
        EcResult<Void> r = game.train.rune.customRune(cc.getRole(), tid, skills);
        if(!r.ok()){
            game.notice.message(cc.getRole(), r.message);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBBag.RUNE_BOX_USE_REQ;
    }
}
